<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>

<body>
  <button id="btn">按钮</button>

  <script>
    btn.addEventListener("click", function (ev) {
      console.log("冒泡:btn");
    });

    btn.addEventListener(
      "click",
      function (ev) {
        console.log("捕获:btn 1");
      },
      true
    );

    btn.addEventListener(
      "click",
      function (ev) {
        // ev.stopImmediatePropagation();
        ev.stopPropagation();
        console.log("捕获:btn 2");
      },
      true
    );

    btn.addEventListener(
      "click",
      function (ev) {
        console.log("捕获:btn 3");
      },
      true
    );


    document.addEventListener("click", function () {
      console.log("冒泡:document");
    })

    document.addEventListener("click", function (ev) {
      console.log("捕获:document");
    }, true)

  </script>
</body>

</html>